<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <script src="layui/layui.js"></script>
    <script src="jquery-3.6.0.js"></script>
</head>
<body>
<form>
<input id="name">
<input id="amount">
<button id="pay">支付</button>
</form>
</body>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        $("#pay").on('click', function () {
            $.ajax({
                url: "/alipay/aliapy",
                contentType: 'application/json;charset=UTF-8',
                data:{"name":$("#name").val(),"amount":$("#amount").val()},
                dataType: "json",
                type: "post",
                success: function (result) {
                    if (result.code == '0') {
                        layer.msg(result.msg, {icon: 6});
                    } else {
                        layer.msg(result.msg, {icon: 5});
                    }
                }
            })
        })
    })
</script>
</html>